package hibernate;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import model.IAlbum;
import model.IArtist;

import org.hibernate.annotations.Proxy;

/**
 * 
 * @author isaac
 *
 */
@Entity
@Table(name="artist")
@Proxy(proxyClass=IArtist.class)
public class Artist implements IArtist {
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="artist_id")
	private Integer Id;
	
	@Column(name="name")
	private String name;
	
	@OneToMany(targetEntity=Album.class, cascade=CascadeType.ALL)
	@JoinColumn(name="artist_id")
	private Set<IAlbum> albums = new HashSet<IAlbum>();
	/* (non-Javadoc)
	 * @see hibernate.IArtist#getId()
	 */

	public Integer getId() {
		return Id;
	}
	/* (non-Javadoc)
	 * @see hibernate.IArtist#setId(java.lang.Integer)
	 */
	public void setId(Integer id) {
		Id = id;
	}
	/* (non-Javadoc)
	 * @see hibernate.IArtist#getName()
	 */
	public String getName() {
		return name;
	}
	/* (non-Javadoc)
	 * @see hibernate.IArtist#setName(java.lang.String)
	 */
	public void setName(String name) {
		this.name = name;
	}
	public Set<IAlbum> getAlbums() {
		return albums;
	}
	public void setAlbums(Set<IAlbum> albums) {
		this.albums = albums;
	}
}